import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo1 {
    //多线程新文件夹笔记
    //创建一个普通线程池
    public static void main(String[] args) {
        //不限制线程个数
        //ExecutorService executorService1 = Executors.newCachedThreadPool();
        //控制线程个数
        ExecutorService executorService2 = Executors.newFixedThreadPool(10);
        for(int i = 0;i < 10000;i++) {
            int id = i;
            //executorService1.submit(new Runnable() {
            executorService2.submit(new Runnable() {
                public void run() {
                    System.out.println("hello " + id + "," + Thread.currentThread().getName());
                }
            });
        }
    }
}
